SELECT
    '${databaseid}' databaseid,
  T. NAME  OBJECTNAME ,
   'TABLE' OBJECTTYPE ,
  trim(T.  CREATOR ) OBJECTSCEMA ,
  null as DDL,
  T.CTIME CREATETIME,
  T.ALTER_TIME UPDATETIME,
  T.REMARKS remark
FROM
     SYSIBM.SYSTABLES T
    where T.CREATOR not like 'SYS%'
    and T.type='T'
    union all

SELECT
   '${databaseid}' databaseid,
  V. NAME  OBJECTNAME ,
   'VIEW' OBJECTTYPE ,
trim(  V.  CREATOR ) OBJECTSCEMA ,
  V. TEXT as DDL,
  T.CTIME CREATETIME,
  T.ALTER_TIME UPDATETIME,
  null remark
FROM
    SYSIBM.SYSVIEWS V inner join   SYSIBM.SYSTABLES T on t.NAME =V.NAME  and t.CREATOR =v.CREATOR and t.type='V'
    where V.CREATOR not like 'SYS%'



    union all

    select '${databaseid}' databaseid ,
    P.SPECIFICNAME OBJECTNAME ,
    'PROCEDURE' OBJECTTYPE ,
   trim(P.PROCSCHEMA)  OBJECTSCEMA,
    p.text ddl,
  p.CREATE_TIME CREATETIME,
  p.CREATE_TIME UPDATETIME,
  null remark


    from  SYSCAT.PROCEDURES P
    where P.PROCSCHEMA not like 'SYS%' and P.PROCSCHEMA !='SQLJ'

    union all

      select '${databaseid}' databaseid ,
    P.SPECIFICNAME OBJECTNAME ,
    'FUNCTION' OBJECTTYPE ,
    trim(P.FUNCSCHEMA) OBJECTSCEMA,
    p.body ddl,
  p.CREATE_TIME CREATETIME,
  p.CREATE_TIME UPDATETIME,
  null remark


    from  SYSCAT.FUNCTIONS P
    where P.FUNCSCHEMA not like 'SYS%' and P.FUNCSCHEMA !='SQLJ'
    
        union all

      select '${databaseid}' databaseid ,
    T.TRIGNAME OBJECTNAME ,
    'TRIGGER' OBJECTTYPE ,
    trim(T.TRIGSCHEMA) OBJECTSCEMA,
    T.TEXT ddl,
  T.CREATE_TIME CREATETIME,
  T.CREATE_TIME UPDATETIME,
  null remark

    from  SYSCAT.TRIGGERS T
    where T.TRIGSCHEMA not like 'SYS%' and T.TRIGSCHEMA !='SQLJ'